
    <nav class="ml-md-auto my-1">
        <ul class="pagination pagination-lg justify-content-end">
            @if ($paginator->hasPages())
                @if ($paginator->onFirstPage())
                    <li class="page-item disabled" >
                        <a class="page-link" href="javascript:;">上一页</a>
                    </li>
                @else
                    <li class="page-item previous ">
                        <a class="page-link" href="{{ $paginator->previousPageUrl() }}" >上一页</a>
                    </li>
                @endif

                @foreach ($elements as $element)
                    {{-- "Three Dots" Separator --}}
                    @if (is_string($element))
                        <li class="page-item disabled" ><span>{{ $element }}</span></li>
                    @endif

                    {{-- Array Of Links --}}
                    @if (is_array($element))
                        @foreach ($element as $page => $url)
                            @if ($page == $paginator->currentPage())
                                <li class="page-item active" >
                                    <a class="page-link" href="javascript:;">{{ $page }}<span class="sr-only">(current)</span></a>
                                </li>
                            @else
                                <li class="page-item">
                                    <a class="page-link" href="{{ $url }}">{{ $page }}</a>
                                </li>
                            @endif
                        @endforeach
                    @endif
                @endforeach

                @if ($paginator->hasMorePages())
                    <li class="page-item next">
                        <a class="page-link" href="{{ $paginator->nextPageUrl() }}">下一页</a>
                    </li>
                @else
                    <li class="page-item disabled">
                        <a class="page-link" href="javascript:;">下一页</a>
                    </li>
                @endif
            @endif

            <li class="page-item disabled">
                <a class="page-link" href="javascript:;">共{{$paginator->lastPage()}}页</a>
            </li>
            <li class="page-item disabled ml-2">
                <div class="mr-1">
                    到第
                    <input type="text" class="form-control page-num form-control-lg mx-1"
                           style="display: inline-block;width: 80px;"
                           onkeyup="this.value=this.value.replace(/\D/, '');"
                           min="1" max="{{$paginator->lastPage()}}"
                           value="{{$paginator->currentPage()}}"
                    >页
                    <button class="btn btn-primary btn-lg btn-jump">跳转</button>
                </div>
            </li>
        </ul>

    </nav>
    @push('scripts')
        <script type="text/javascript">
            $("select[name='prePageNum']").on('change', function(){
                var perNum = $(this).children('option:selected').val();
                var url = window.location.href;
                if(url.indexOf("per=") >= 1){
                    var u = url.split("per=");
                }else{
                    if(url.indexOf("?") >= 1){
                        var nurl = url+"&per="+perNum;
                    }else{
                        var nurl = url+"?per="+perNum;
                    }
                }
                if(u) {
                    var e = u[1].split("&");
                    var d="";
                    if(e.length > 1){
                        for(var i=0;i<e.length-1;i++){
                            d += "&"+e[i+1];
                        }
                    }
                    var nurl = u[0] + "per=" + perNum+d;
                }
                location = nurl;
            });

            $('.btn-jump').click(function(){
                var maxPage = parseInt('{{$paginator->lastPage()}}');
                var jumpPae =  parseInt($('.page-num').val());
                jumpPae = jumpPae<=0?1:jumpPae;
                jumpPae = jumpPae>maxPage?maxPage:jumpPae;

                var url = window.location.href;
                if(url.indexOf("page=") >= 1){
                    var u = url.split("page=");
                }else{
                    if(url.indexOf("?") >= 1){
                        var nurl = url+"&page="+jumpPae;
                    }else{
                        var nurl = url+"?page="+jumpPae;
                    }
                }
                if(u) {
                    var e = u[1].split("&");
                    var d="";
                    if(e.length > 1){
                        for(var i=0;i<e.length-1;i++){
                            d += "&"+e[i+1];
                        }
                    }
                    var nurl = u[0] + "page=" + jumpPae+d;
                }
                location = nurl;
            });
        </script>
    @endpush